<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="PermisoEditDlg" widgetVar="PermisoEditDialog" modal="true" resizable="false" appendToBody="true" header="#{bundle.EditPermisoTitle}">

            <h:form id="PermisoEditForm">

                <h:panelGroup id="display">
                    <p:panelGrid  columns="2" rendered="#{permisoController.selected != null}">

                        <h:outputLabel value="#{bundle.EditPermisoLabel_id}" for="id" />
                        <h:outputText id="id" value="#{permisoController.selected.id}" />

                        <p:outputLabel value="#{bundle.EditPermisoLabel_codigo}" for="codigo" />
                        <p:inputText id="codigo" value="#{permisoController.selected.codigo}" title="#{bundle.EditPermisoTitle_codigo}" required="true" requiredMessage="#{bundle.EditPermisoRequiredMessage_codigo}"/>

                        <p:outputLabel value="#{bundle.EditPermisoLabel_fechaPermiso}" for="fechaPermiso" />
                        <p:calendar id="fechaPermiso" pattern="MM/dd/yyyy" value="#{permisoController.selected.fechaPermiso}" title="#{bundle.EditPermisoTitle_fechaPermiso}" required="true" requiredMessage="#{bundle.EditPermisoRequiredMessage_fechaPermiso}" showOn="button"/>

                        <p:outputLabel value="#{bundle.EditPermisoLabel_motivo}" for="motivo" />
                        <p:inputText id="motivo" value="#{permisoController.selected.motivo}" title="#{bundle.EditPermisoTitle_motivo}" required="true" requiredMessage="#{bundle.EditPermisoRequiredMessage_motivo}"/>

                        <p:outputLabel value="#{bundle.EditPermisoLabel_creationDate}" for="creationDate" />
                        <p:calendar id="creationDate" pattern="MM/dd/yyyy HH:mm:ss" value="#{permisoController.selected.creationDate}" title="#{bundle.EditPermisoTitle_creationDate}" required="true" requiredMessage="#{bundle.EditPermisoRequiredMessage_creationDate}" showOn="button"/>

                        <p:outputLabel value="#{bundle.EditPermisoLabel_createdBy}" for="createdBy" />
                        <p:inputText id="createdBy" value="#{permisoController.selected.createdBy}" title="#{bundle.EditPermisoTitle_createdBy}" required="true" requiredMessage="#{bundle.EditPermisoRequiredMessage_createdBy}"/>

                        <p:outputLabel value="#{bundle.EditPermisoLabel_lastUpdateDate}" for="lastUpdateDate" />
                        <p:calendar id="lastUpdateDate" pattern="MM/dd/yyyy HH:mm:ss" value="#{permisoController.selected.lastUpdateDate}" title="#{bundle.EditPermisoTitle_lastUpdateDate}"  showOn="button"/>

                        <p:outputLabel value="#{bundle.EditPermisoLabel_lastUpdateBy}" for="lastUpdateBy" />
                        <p:inputText id="lastUpdateBy" value="#{permisoController.selected.lastUpdateBy}" title="#{bundle.EditPermisoTitle_lastUpdateBy}" required="true" requiredMessage="#{bundle.EditPermisoRequiredMessage_lastUpdateBy}"/>

                        <p:outputLabel value="#{bundle.EditPermisoLabel_idUnidad}" for="idUnidad" />
                        <p:selectOneMenu id="idUnidad" value="#{permisoController.selected.idUnidad}" required="true" requiredMessage="#{bundle.EditPermisoRequiredMessage_idUnidad}">
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{unidadController.items}"
                                           var="idUnidadItem"
                                           itemValue="#{idUnidadItem}"
                                           itemLabel="#{idUnidadItem.id.toString()}"
                                           />
                            <f:converter binding="#{unidadConverter}"/>
                        </p:selectOneMenu>

                        <p:outputLabel value="#{bundle.EditPermisoLabel_idSocio}" for="idSocio" />
                        <p:selectOneMenu id="idSocio" value="#{permisoController.selected.idSocio}" required="true" requiredMessage="#{bundle.EditPermisoRequiredMessage_idSocio}">
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{socioController.items}"
                                           var="idSocioItem"
                                           itemValue="#{idSocioItem}"
                                           itemLabel="#{idSocioItem.id.toString()}"
                                           />
                            <f:converter binding="#{socioConverter}"/>
                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{permisoController.save}" value="#{bundle.Save}" update="display,:PermisoListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,PermisoEditDialog);"/>
                    <p:commandButton value="#{bundle.Cancel}" onclick="PermisoEditDialog.hide()"/>
                </h:panelGroup>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>
